package com.adong.config;

import com.adong.dao.UserDao;

import com.adong.pojo.Boss;
import com.adong.pojo.Car;
import com.adong.pojo.Red;
import com.adong.service.UserService;
import org.springframework.context.annotation.*;
import org.springframework.core.type.filter.TypeFilter;
import org.springframework.stereotype.Controller;

/**
 * @author adong
 */
@Configuration
@ComponentScan(value = "com.adong.pojo",
        includeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {Boss.class, Car.class}),
        useDefaultFilters = false)
public class AutoConfig {


    @Primary //自定装配上面@Qualifier("userDao")指定装配的bean,使用@Primary注解默认首选这个注解标注的bean
    @Bean
    public UserDao userDao2() {
        UserDao userDao = new UserDao();
        userDao.setName("flynn");
        return userDao;
    }
    @Bean
    public Red red(){
        return new Red();
    }

}
